import os
import yaml


class ReadConfig:
    @staticmethod
    def read_config_by_key(file_name, key):
        config_path = '\\'.join(os.path.dirname(__file__).split('\\')[:-1]) + rf"\config\{file_name}"

        with open(config_path, "r", encoding="utf-8") as config_file:
            config_data = yaml.safe_load(config_file)[key]
        return config_data


if __name__ == "__main__":
    print(ReadConfig.read_config_by_key("config.yml", "host"))
